ParacolBasicMessageFilters = function() {

    return {
        addFieldsAsObject: {
            transformServerMessageNode: function (value, ctx) {
                if (value.msgType == "EditCookie") {
                    var fields = value.fields;
                    var fieldsObject = {};
                    for (f = 0; f < fields.length; f++) {
                        fieldsObject[fields[f].name] = fields[f];
                    }
                    value.fieldsObject = fieldsObject
                }
                return this._next_.transformServerMessageNode(value, ctx);
            }
        },

        handleJsonDate: {
            transformServerMessageNode: function(value, ctx) {
                // The native JSON support does not convert any formatted date to date object.
                // It must be done manually using this reviver function.
                var reISO = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*)?)Z$/;
                var reMsAjax = /^\/Date\((d|-|.*)\)\/$/;

                if (typeof value === 'string') {
                    var a = reISO.exec(value);
                    if (a) {
                        value = new Date(Date.UTC(+a[1], +a[2] - 1, +a[3], +a[4], +a[5], +a[6]));
                    } else {
                        a = reMsAjax.exec(value);
                        if (a) {
                            var b = a[1].split(/[-,.]/);
                            value = new Date(+b[0]);
                        }
                    }
                }
                return this._next_.transformServerMessageNode(value, ctx);
            }

        }
    }
};

DefaultParacolBasicMessageFilters = ParacolBasicMessageFilters();